package com.explorx.sns.puma.im.core.chat.consts;

import java.util.Arrays;
import java.util.Optional;

public enum UserRelationEnum {
    Stranger((byte)0,"陌生人"),
    Follow((byte)1,"单向关注"),
    Followed((byte)2,"单向被关注"),
    Block((byte)3,"拉黑"),
    Blocked((byte)4,"被拉黑"),
    Friend((byte)5,"朋友");

    UserRelationEnum(byte value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    private byte value;
    private String desc;

   public static UserRelationEnum findById(byte value){

        final Optional<UserRelationEnum> any = Arrays.stream(UserRelationEnum.values()).filter(ele -> ele.getValue() == value).findAny();
        return any.isPresent() ? any.get() :Stranger;
    }
}
